
import 'package:flutter/material.dart';
import 'package:flutterlib/common/datacenter/user_center.dart';
import 'package:flutterlib/common/net/dao_result.dart';
import 'package:flutterlib/common/net/retrofit/post_api.dart';
import 'package:flutterlib/common/style/quhui_style.dart';
import 'package:flutterlib/common/utils/navigator_utils.dart';
import 'package:flutterlib/common/utils/utils.dart';
import 'package:flutterlib/model/post/post_bean.dart';
import 'package:flutterlib/widgets/bussiness/post/post_list_item.dart';
import 'package:flutterlib/widgets/pull/nested/simple_pull_load_manger.dart';
import 'package:flutterlib/widgets/pull/nested/simple_pull_load_page_widget.dart';
import 'package:thrio/thrio.dart';

abstract class PostListWidgetPage extends StatefulWidget {

  PostListWidgetPage({Key key})
      : super(key: key);

  @override
  PostListWidgetPageState createState();
}

///页面 KeepAlive ，同时支持 动画Ticker
abstract class PostListWidgetPageState<T extends PostListWidgetPage> extends State<T>
    with TickerProviderStateMixin {
  SimplePullLoadManger manger;

  ///滑动监听
  final ScrollController scrollController = new ScrollController();

  getDataLogic(int page);

  Widget renderItem(index, post);

  List<Widget> renderHeader(BuildContext context, bool innerBoxIsScrolled);


  @override
  void initState() {
    super.initState();
    manger = SimplePullLoadManger(
        getDataLogic: getDataLogic,
        renderItem: renderItem,
        renderHeader: renderHeader,
        );
  }

  @override
  void didUpdateWidget(T oldWidget) {
    // TODO: implement didUpdateWidget
    super.didUpdateWidget(oldWidget);
  }

  @override
  Widget build(BuildContext context) {
    trueDebugPrint("flutterting postlistwidgetpage build");
    return SimplePullLoadWidget(
      pullLoadManger: manger,
    );
  }
}
